package ua.cn.store.impl;

import java.sql.Timestamp;
import java.util.List;

import ua.cn.store.domain.Comment;
import ua.cn.store.service.GeneralServiceException;
import ua.cn.store.service.ICommentService;

public class CommentServiceImpl extends GenericServiceImpl<Comment> implements
		ICommentService {

	public CommentServiceImpl() {
		super(Comment.class);
	}

	@Override
	public List<Comment> getByDate(Timestamp timestamp)
			throws IllegalArgumentException, GeneralServiceException {
		if (timestamp == null){
			throw new IllegalArgumentException("Comment timestamp is null");
		}
		return executeQuery("Comment.getByDate",true, false, timestamp);
	}

	@Override
	public List<Comment> getCommentByBook(Long id)
			throws IllegalArgumentException, GeneralServiceException {
		if (id == null){
			throw new IllegalArgumentException("Book id is null");
		}
		return executeQuery("Comment.getCommentByBook", true, false, id);
	}

	@Override
	protected void beforeEntityAddUpdate(Comment obj)
			throws GeneralServiceException {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void beforeEntityDelete(Comment obj)
			throws GeneralServiceException {
		// TODO Auto-generated method stub
		
	}

}
